|
ContentsOperating on the semantic graphAll model configurations in Simantics are stored into a semantic graph database. Therefore it is the most primitive interface for accessing Simantics and in principle everything is doable with it, although sometimes with a great effort. Understanding semantic graphsThe best tool for discovering how the model configuration is represented in the Simantics, is Graph debugger. It can be opened from Window/Show View/Other. Resources can be dragged to the debugger from the model browser. The debugger shows the URI of the resource and all statements related to it. Accessing resourcesdata Resource (Simantics/DB) A resource is a node in a semantic graph. resource :: String -> <ReadGraph> Resource (Simantics/DB) Converts an absolute URI to a resource relativeResource :: Resource -> String -> <ReadGraph> Resource (Simantics/DB) Converts a relative URI to a resource starting from the given resource possibleResource :: String -> <ReadGraph> Maybe Resource (Simantics/DB) Converts an absolute URI to a resource or returns uriOf :: Browsable a => a -> <ReadGraph> String (Simantics/DB) Returns the URI of the given value. currentModel :: <ReadGraph> Resource (Simantics/DB) Gives the current active model. Navigating(#) :: Resource -> Resource -> <ReadGraph> [Resource] (Simantics/DB)
possibleObject :: Resource -> Resource -> <ReadGraph> Maybe Resource (Simantics/DB) If there is exactly one object with the given singleObject :: Resource -> Resource -> <ReadGraph> Resource (Simantics/DB) Assumes that there is exactly one object with the given subject and predicate and returns it. data Statement (Simantics/DB) A statement is an edge in a semantic graph. statements :: Resource -> Resource -> <ReadGraph> [Statement] (Simantics/DB) statements subject predicate` returns all statements with the given subject and predicate. singleStatement :: Resource -> Resource -> <ReadGraph> Statement (Simantics/DB) Assumes that there is exactly one statement with the given subject and predicate and returns it. Reading literal valuesnameOf :: Browsable a => a -> <ReadGraph> String (Simantics/DB) Reads the name of the value. Type queriesisInstanceOf :: Resource -> Resource -> <ReadGraph> Boolean (Simantics/DB)
isSubrelationOf :: Resource -> Resource -> <ReadGraph> Boolean (Simantics/DB) isInheritedFrom :: Resource -> Resource -> <ReadGraph> Boolean (Simantics/DB) singleTypeOf :: Resource -> Resource -> <ReadGraph> Resource (Simantics/DB) possibleTypeOf :: Resource -> Resource -> <ReadGraph> Maybe Resource (Simantics/DB) TransactionsThe graph database can be accessed only in reading or writing transactions. The SCL console creates the transaction automatically if necessary, but sometimes it is necessary to control manually where the transactions are started. syncRead :: (() -> <Proc,ReadGraph> a) -> <Proc> a (Simantics/DB) Executes a read transaction and waits that it completes. syncWrite :: (() -> <Proc,ReadGraph,WriteGraph> a) -> <Proc> a (Simantics/DB) Executes a write transaction and waits that it completes. asyncRead :: (() -> <Proc,ReadGraph> a) -> <Proc> () (Simantics/DB) Begins a read transaction and immediately returns. asyncWrite :: (() -> <Proc,ReadGraph,WriteGraph> a) -> <Proc> () (Simantics/DB) Begins a write transaction and immediately returns. WritingnewResource :: () -> <WriteGraph> Resource (Simantics/DB) Creates a new resource. claim :: Resource -> Resource -> Resource -> <WriteGraph> () (Simantics/DB) Adds a statement to the semantic graph. claimRelatedValue :: Serializable a => Resource -> Resource -> a -> <WriteGraph> () (Simantics/DB) Sets the value of the literal that is an object with the given subject and predicate. deny :: Resource -> Resource -> Resource -> <WriteGraph> () (Simantics/DB) Removes a statement with the given subject, predicate and object Entities
SearchingsearchByType :: Resource -> Resource -> <ReadGraph> [Resource] (Simantics/Model) searchByTypeShallow :: Resource -> Resource -> <ReadGraph> [Resource] (Simantics/Model) searchByTypeAndName :: Resource -> Resource -> String -> <ReadGraph> [Resource] (Simantics/Model) searchByTypeAndNameShallow :: Resource -> Resource -> String -> <ReadGraph> [Resource] (Simantics/Model) searchByQuery :: Resource -> String -> <ReadGraph> [Resource] (Simantics/Model) searchByQueryShallow :: Resource -> String -> <ReadGraph> [Resource] (Simantics/Model)
|